﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Entity.ModelConfiguration;
using INSE6260.OnlineBanking.Model.Payee;

namespace INSE6260.OnlineBanking.Repository.EF.Mappings
{
    public class PayeeTypeConfiguration : EntityTypeConfiguration<Payee>
    {
        public PayeeTypeConfiguration()
        {
            this.HasKey(t => t.Id);
            this.ToTable("Payee");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.ClientId).HasColumnName("ClientId");
            this.Property(t => t.PayeeNameId).HasColumnName("PayeeNameId");
            this.Property(t => t.NickName).HasColumnName("NickName").HasMaxLength(50);
            this.Property(t => t.AccountNo).HasColumnName("AccountNo").HasMaxLength(50);
            this.HasRequired(t => t.Client).WithMany(t => t.Payees).HasForeignKey(d => d.ClientId);
            this.HasRequired(t => t.PayeeName).WithMany(t => t.Payees).HasForeignKey(d => d.PayeeNameId);
        }
    }
}
